package com.hsck.order.kds.setup.adapter

import androidx.annotation.LayoutRes
import com.hsck.order.kds.R
import com.hsck.order.kds.base.bean.FoodNumBean
import com.hsck.order.kds.base.common.BaseAdapter
import com.hsck.order.kds.base.common.BaseViewHolder
import com.hsck.order.kds.base.common.setSpannableString
import kotlinx.android.synthetic.main.item_food_num.view.*

/**
 * 沽清菜品分页-适配器
 */
class FoodNumAdapter(@LayoutRes layoutId: Int) : BaseAdapter<FoodNumBean>(layoutId) {

    override fun onBindViewHolder(holder: BaseViewHolder, data: FoodNumBean) {

        holder.itemView.tv_item_food_num.text = "${data.index}"
        if (data.isSelected){
            holder.itemView.tv_item_food_num.setSpannableString(colorId = R.color.white)
            holder.itemView.tv_item_food_num.setBackgroundResource(R.drawable.shape_blue00_borderless6)
        }else{
            holder.itemView.tv_item_food_num.setSpannableString(colorId = R.color.gray66)
            holder.itemView.tv_item_food_num.setBackgroundResource(R.drawable.shape_graydc_border6)
        }
    }

}